Interface and Application Programming
Assignment:
Write an application that interfaces with an input or output device that I made using bluetooth while comprising with many tool options.
Plan:
My idea for this week is to link my phone with a Led and use my phone to be like a LED switch on/off.
Eagle:
First I have to prepare an LED Board for the blue tooth linkng. As in the previous weeks I used Eagle software for optimal connection using auto router. As such I gonna use similar LED Board to week 15 .
Components:
1- Attitiny 45
2- 3 10 k resistors
3- 330 ohm resisotr
4- LED
5- 10 UF capacitor
6- 2x2 pin
7- ISP (3X3 pin)
and
Programming my board:
#include <SoftwareSerial.h>
SoftwareSerial mySerial(0, 255); // RX, TX
#define LED 4
char c;
void setup() {
// Open serial communications and wait for port to open:
mySerial.begin(9600);
pinMode(LED, OUTPUT);
digitalWrite(LED, HIGH);
delay(1000);
digitalWrite(LED, LOW);
}
void loop() { // run over and over
while (mySerial.available() <= 0);
c = mySerial.read();
if (c == '1') {
digitalWrite(LED, HIGH);
delay(500);
}
else
digitalWrite(LED, LOW);
}
MIT App Inventor:
For the first time I gonna use MIT app inventor. The APP require to have a user interafce, on/off switch , and blue tooth client connectivity.
Setting my LED on/off switch button and try link it with a phone.
Block part:
I have to create a sequence command in MIT app when linking my phone with my LED board with the following:
1) when pressing 1 the LED will work
2) when pressing 0 the LED will switch off
Final Result: